package com.itheima.clientAndService01;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

public class IOClass04 {
    public static void main(String[] args) throws UnsupportedEncodingException {
        String s = "我有一只小毛驴，我从来也不骑！";
        byte[] bytes1 = s.getBytes();
        System.out.println(Arrays.toString(bytes1));
        byte[] bytes2 = s.getBytes("UTF-8");
        System.out.println(Arrays.toString(bytes2));
        byte[] bytes3 = s.getBytes("GBK");
        System.out.println(Arrays.toString(bytes3));

        String str1 = new String(bytes1);
        System.out.println(str1);
        String str2 = new String(bytes2,"UTF-8");
        System.out.println(str2);
        String str3 = new String(bytes3,"GBK");
        System.out.println(str3);
    }
}
